package com.yequan.map;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yq
 * @date 2020/09/28
 */
public class HashMapRemoveDemo {

    private static Map<String, Integer> map = new HashMap<>();

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 100; i++) {
            map.put("k" + i, i);
        }
        Thread.sleep(1000);
        new Thread(() -> map.remove("k10")).start();
        new Thread(() -> map.put("k10",10)).start();
        new Thread(() -> map.put("k10",10)).start();
        new Thread(() -> map.put("k10",10)).start();
        new Thread(() -> map.remove("k10")).start();
        new Thread(() -> map.remove("k10")).start();
        new Thread(() -> map.remove("k10")).start();
        new Thread(() -> map.remove("k10")).start();
        new Thread(() -> map.remove("k10")).start();
        System.out.println(map.get("k10"));
    }

}
